<template>
  <scroll class="content" :scrollX="true" :scrollY="false" :width="wrapWidth">
    <div class="movie-Wrap" ref="wrap">
      <div class="goodLove">
        <div class="navList" v-for="item in movieList" :key="item.id">
          <div class="main-con">
            <img :src="item.img | setWH('128.180')" />
            <div class="sorce" v-if="item.sc">
              <span>观众评分</span>
              <span>{{ item.sc }}</span>
            </div>
            <div class="sorce" v-else>
              <span>{{ item.wish }}</span>
              <span>人想看</span>
            </div>
            <p class="desc">{{ item.nm }}</p>
          </div>
        </div>
      </div>
    </div>
  </scroll>
</template>
<script>
export default {
  /*  props: {
    isLoading: Boolean,
  }, */
  data() {
    return {
      wrapWidth: 2880,
      movieList: [],
    };
  },
  mounted() {
    this.isLoading = true;
    this.axios.get("/api/movie/comGoods").then((res) => {
      console.log(res);
      var comingList = res.data.coming;
      console.log(comingList);
      this.movieList = comingList;
      this.isLoading = false;
    });
  },
  watch: {
    movieList() {
      this.wrapWidth = this.$refs.wrap.offsetWidth;
      console.log(this.$refs.wrap.offsetWidth);
    },
  },
  /*  updated() {
    this.wrapWidth = this.$refs.wrap.offsetWidth;
    console.log(this.wrapWidth);
  }, */
};
</script>

<style lang="scss" scoped>
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
// .scroll-wrap {
//   width: 2000px;
// }
.movie-Wrap {
  box-sizing: border-box;
  background-color: #fff;
  display: flex;
  height: 150px;
  flex-direction: column;
}
.goodLove {
  display: flex;
  position: relative;
  margin: 0 10px;
  z-index: 10;
  background-color: #fff;
  .navList {
    display: flex;
    width: 85px;
    margin-right: 10px;
    flex-direction: column;
    .main-con {
      position: relative;
      width: 85px;
      height: 115px;
      margin-bottom: 6px;
      img {
        width: 85px;
        height: 115px;
      }
      .sorce {
        position: absolute;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 20%;
        display: flex;
        align-items: center;
        justify-content: space-around;
        background-image: linear-gradient(-180deg, rgba(77, 77, 77, 0.6), #000);
        color: #faaf00;
      }
    }
    .desc {
      color: #222;
      font-weight: 700;
      font-size: 11px;
      margin-bottom: 3px;
      margin-top: 6px;
    }
  }
}
</style>
